<?php
function lilina_userapi_check_unique($args)
{
    extract($args);
    if (!isset($unique)) {
        $msg = xarML('Invalid Parameter Count');
        xarErrorSet(XAR_SYSTEM_EXCEPTION, 'BAD_PARAM', new SystemException($msg));
        return;
    }
    $dbconn =& xarDBGetConn();
    $xartable =& xarDBGetTables();

    $gtable = $xartable['garbage'];
    $query = "SELECT xar_unique
              FROM $gtable 
              WHERE xar_unique = ?";
    $result =& $dbconn->Execute($query, array($unique));
    if (!$result) return;
    if($result->EOF){
        $stable = $xartable['story'];
        $query = "SELECT xar_id
                  FROM $stable 
                  WHERE xar_unique = ?";
        $result =& $dbconn->Execute($query, array($unique));
        if (!$result) return;
        if($result->EOF){
            return false;
        } else {
            return true;
        }
    } else {
        return true;
    }
}
?>